<!DOCTYPE html>
<html lang="cn">
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta charset="utf-8" />
		<title>PMS-business</title>
		<meta name="description" content="overview &amp; stats" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
		<script type="text/javascript">
			window.$ = window.jQuery = require('./assets/js/jquery.js');
		</script>
		<script src="./js/jquery.window.reference.js"></script>
		<link rel="stylesheet" type="text/css" href="./js/tabs/bootstrap.addtabs.css" />
	</head>
	<style>
		#sidebar.sidebar.h-sidebar:before{
			height: 0;
			top: 0;
		}
	</style>
	<body class="no-skin" style="overflow:hidden;">
        <div id="navbarTitle">
            <div id="navbar" class="navbar navbar-default navbar-collapse collapse">
	    		<script type="text/javascript">
					try{ace.settings.check('navbar','fixed')}catch(e){}
				</script>
				<div class="navbar-container" id="navbar-container"> 
					<div class="navbar-header pull-left" id="navbar-container-first">
						<a href="javascript:void(0);" class="navbar-brand"> 
							<small id="index_Title"></small>
						</a>
					</div>    
					<div class="navbar-buttons navbar-header pull-right  collapse navbar-collapse" role="navigation">
						<ul class="nav ace-nav">
                            <li class="purple allPushIndexMess">  
                                <a data-toggle="dropdown" class="dropdown-toggle" href="#"> 
                                    <i class="ace-icon fa fa-bell icon-animated-bell"></i> 
                                    <span class="badge badge-important">0</span> 
                                </a> 
                                <ul class="dropdown-menu-right dropdown-navbar navbar-pink dropdown-menu dropdown-caret dropdown-close">  
                                    <li class="dropdown-header"> 
                                        <i class="ace-icon fa fa-exclamation-triangle"></i>
                                        <span class="allPushIndexMess_head">1234</span>  
                                    </li> 
                                    <li class="dropdown-content ace-scroll" style="position: relative;"> 
                                        <div class="scroll-content" style="max-height: 200px;overflow-y:auto;">   
                                            <ul class="dropdown-menu dropdown-navbar navbar-pink allPushIndexMess_content">   
                                                <li>    
                                                    <a href="#" style="cursor:pointer;"> 
                                                            <div class="clearfix"> 
                                                                <span class="pull-left"> 
                                                                <i class="btn btn-xs no-hover btn-pink fa fa-comment"></i> New Comments 
                                                                </span> 
                                                                <span class="pull-right badge badge-info">+12</span> 
                                                            </div> 
                                                    </a> 
                                                </li> 
                                            </ul> 
                                        </div>
                                    </li> 
                                    <li class="dropdown-footer"> 
                                        <a href="#">查看全部 
                                            <i class="ace-icon fa fa-arrow-right"></i> 
                                        </a> 
                                    </li> 
                                </ul> 
                            </li>
                        
                            
							<li class="light-blue">
		                        <a data-toggle="dropdown" href="#" class="dropdown-toggle"> 
									<span class="user-info">
										<small data-i18n="">欢迎您</small>
                                        <span id="indexUsername"></span>
									</span>
									<i class="ace-icon fa fa-caret-down"></i>   
		                     	</a>
								<ul class="user-menu dropdown-menu-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
		                            <li>
		                                <a data-i18n="" id="indexOff" >
		                                    <i class="ace-icon fa fa-power-off"></i>注销
		                                </a>
		                            </li>
								</ul>
							</li>
						 </ul>
					</div>
                    <div class="row hide"></div>
					<div class="indexDowebok navbar-header pull-right" style="margin-top: 16px;background: center;"></div>    
				</div>
	    	</div>
        </div>
		<div class="main-container" id="main-container">
			<script type="text/javascript">
            	try{ace.settings.check('main-container' , 'fixed')}catch(e){}
			</script>
			
			<div id="main-content" class="main-content" style="position: relative;height:calc(100% - 90px);width: 100%;"> 
                <div class="page-content">
                    <div id="pagemain" class="page-content-area" data-ajax-content=true></div>
                </div>
			</div>
            <div id="sidebar" class="sidebar h-sidebar navbar-collapse" style="z-index:1000;margin-top: 0px;border-top: 0px dotted #79b0ce !important;width: 100%;position: relative !important;bottom: 0px !important;"></div>
			<div class="indexMess_timer" style="position:fixed;left:40px;height: 20px;bottom:7px;"></div>
		</div>
        <script>
            var hotelId = localStorage.getItem("hotelId");
            var bmh = localStorage.getItem("bmh");
            var userid = localStorage.getItem("userid");
			var token = localStorage.getItem("token");
			var loginInfo = localStorage.getItem("loginInfo");
			if(loginInfo){
				loginInfo = $.parseJSON(loginInfo);
			}
            $("#indexUsername").text(loginInfo.username)
            $.HSAPI_HEADERS.hotelId = hotelId;
            $.HSAPI_HEADERS.bmh = bmh;
            $.HSAPI_HEADERS.token = token;
			$.HSAPI_USERID = userid;
			localStorage.removeItem('openWin');
			
			jQuery.ajaxSetup({
				headers : $.HSAPI_HEADERS,
				complete:function(){
					$("#pageOverlay").addClass("hide");
					$("#loading").addClass("hide");
				}
			});

            $("#indexOff").unbind("click").click(function(){
                jf_alert("确定注销当前用户?",function(){
                    $.HSAPI_CLOSEWINS();
                    localStorage.removeItem("token");
                    window.location.href="html/login/login.html";
                });
                return false;
            })
			
			//字典
			getDict();

			var arg1 = {"arg":{"app":$.HSAPI_HEADERS.app}}
			var arg2 = {};
			var procedure = 'HoLoginMenuNew';

			$.HSAPI_CALLPROCEDURE2(arg1,procedure,arg2,function(data){
				localStorage.setItem("opdate",data.opdate);
				localStorage.setItem("lastdate",data.lastdate);
				localStorage.setItem("qckMenu",JSON.stringify(data.menu));
                localStorage.setItem("shortcut",JSON.stringify(data.shortcut));
				localStorage.setItem(localStorage.getItem("hotelId")+"_opdate",data.opdate);
				if(data.RETURN==1){
					$("#sidebar").indexMenuShort({
						app : $.HSAPI_HEADERS.app,
						appendDivId:"sidebar",
						menu:data.menu,
                        shortcut:data.shortcut,
						indexOff_href : "html/login/login.html",
						homepage_href : "index.html",
						//----------新增菜单插件模式->打开新窗口模式--------
						//mode:"newWindow",//不加此参数为单窗体加载页面模式
						// newWindow:function(params){
						// 	$.HSAPI_NEWWINDOW(params,params.hash);
						// 	$.HSAPI_WINDOWOPEN();
						// }
						//------------------结束---------------------------
					});

                    var kn = localStorage.getItem("kn")
                    var loginInfo = JSON.parse(localStorage.getItem("loginInfo"))
                    var messSN = loginInfo.serialNo
                    var validata = loginInfo.MSG
                    var packagename = $.HSAPI_PACKAGENAME;
                    var path_arr = $.HSAPI_AJAXURL.split("/")
                    var path = $.HSAPI_AJAXURL.replace("/"+path_arr[path_arr.length-1],"")
                    jQuery.ajax(path+'/pic/'+packagename+'/'+$.HSAPI_HEADERS.hotelId+'/logo.png', {  
			            type: 'get',
// 			            timeout: 1000,  
			            success: function() {
			            	$("#index_Title").html("");
			            	if($("#navbarTitleImg")&&$("#navbarTitleImg").length>0){  
			            		$("#index_Title").html(data.hotelname+"&nbsp&nbsp<font size='2'>"+data.hotelename+";营业日期:"+data.opdate+";班次:"+kn+";序列号:"+messSN+";"+validata+"</font>");
			            	}else{
			            		$("#index_Title").html('<img alt="" src="'+path+'/pic/'+webName+'/'+jf_getHotelId()+'/logo.png" height="30px"/>'
										+data.hotelname+"&nbsp&nbsp<font size='2'>"+data.hotelename+";营业日期:"+data.opdate+";班次:"+kn+";序列号:"+messSN+";"+validata+"</font>");
			            	}
			            	$(".indexDowebok").css("width",$("#navbar").width()-$("#index_Title").width()-300);  
			            }, 
			            error: function() {
			            	$("#index_Title").html("");
							$("#index_Title").html('<i class="fa fa-leaf"></i>'+data.hotelname+"&nbsp&nbsp<font size='2'>"+data.hotelename+";营业日期:"+data.opdate+";班次:"+kn+";序列号:"+messSN+";"+validata+"</font>");
							
							
							$(".indexDowebok").css("width",$("#navbar").width()-$("#index_Title").width()-300);  
			            }
			        });
					
							
					$("#main-content").css("height",$(window).height()-$("#sidebar").height()-$("#navbarTitle").height()).css("min-height",$(window).height()-$("#sidebar").height()-$("#navbarTitle").height());
					$("#main-content").css("overflow-y","auto");
					$("#main-content").css("overflow-x","hidden");
					$(window).on("resize", function(){ 
						$("#main-content").css("height",$(window).height()-$("#sidebar").height()-$("#navbarTitle").height()).css("min-height",$(window).height()-$("#sidebar").height()-$("#navbarTitle").height());
						$("#main-content").css("overflow-y","auto");
						$("#main-content").css("overflow-x","hidden");
					});

					jQuery.ajax({  
						type : 'POST',
						async:false, 
						url : $.HSAPI_AJAXURL+"/qms/mobile/procedure2",
						data: $.HSAPI_ASKJSONINFO(JSON.stringify({}),'HoLoginStoreList',JSON.stringify({})), 
						dataType : 'json',  
						success : function(data){
							if(data.RETURN=="1"){
								localStorage.setItem("button_authority",JSON.stringify(data.button));
							}else{
								jf_alert(data.MSG)
							}
						},  
						error : function(data){
							systoast('HoLoginStoreList错误提示:','系统后台提交错!' + JSON.stringify(data),'error')
						}  
					});
				   
					jQuery.ajax({  
						type : 'POST',
						url : $.HSAPI_AJAXURL+"/qms/mobile/procedure2",   
						data : $.HSAPI_ASKJSONINFO('{}',"ListRetrieveAlinarg",'{}','list'),
						dataType : 'json',  
						async:false,
						success : function(data) {  
							localStorage.setItem("alinarg",JSON.stringify(data.DATA));        	  
						},  
						error : function(data) {  
							$.HSAPI_ALTER("获取酒店ID:"+jf_getHotelId()+"的参数失败<br>原因:"+data);
						}  
					});

                    jQuery.ajax({  
                        type : 'POST',
                        url : $.HSAPI_AJAXURL+"/qms/mobile/procedure2",  
                        data : $.HSAPI_ASKJSONINFO('{}',"Alin_notice_boardRetrieve",'{}'),
                        dataType : 'json',  
                        success : function(data){
                            if(data.RETURN>0){ 
                                
            // 					console.log(JSON.stringify(data)) 
                                var html="";
                                for(item in data.notice){
                                    html+=getTextStyle(data.notice[item]);    
                                }
                                $(".indexDowebok").html(html);  
                                $('.indexDowebok').liMarquee({
                                    circular: false
                                });
                                
                            }
                        }
                    });

					$("#index_TitleSub").text(data.hotelname+"；营业日期："+data.opdate+"；")
				}
			},function(data){
				$.HSAPI_ALTER(JSON.stringify(data));
			});

			function getDict(){
				jQuery.ajax( {  
					type : 'POST',  
					url :$.HSAPI_AJAXURL+"/qms/mobile/procedure2",  
					async:false,
					data : $.HSAPI_ASKJSONINFO( '{}','ExecHoDictRetrieveDefault','{}','list'),
					dataType : 'json',
					success : function(data) { 
						localStorage.setItem("hodict",JSON.stringify(data.DATA));
					},  
					error : function(data) {  
						jf_alert("获取典失败<br>原因:"+data);
					}  
				});
			}
		</script>
	</body>
</html>
